﻿<!DOCTYPE>
<html ng-app="testLogin">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, width=device-width, minimal-ui">
    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
	<link rel="stylesheet" type="text/css" href="/css/pensonel.css" />
    <link rel="stylesheet" type="text/css" href="/framework/angular-tooltips-master/dist/angular-tooltips.min.css"/>
    <script src="/framework/angular-wang-editor/dist/js/lib/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/framework/angular.min.js"></script>
    <script src="/images/icon/iconfont.js" type="text/javascript"></script>
    <title ng-bind="systemTitle"></title>
</head>
<body  ng-controller="testLoginCtl">
	 
     <!--loading-->
        <div class="jisuloading" style="z-index:10001">
        <div class="img">
            <center>
            <img src="/images/yemianloding.gif" width="90" height="90" />
            </center>
            <span ng-bind="user_name"></span>正在加载中请稍后。。。
        </div>
    </div>

    <script type="text/javascript" src="/framework/lodash.min.js"></script>
    <script type="text/javascript" src="/framework/restangular/restangular.min.js"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.min.js"></script>
    <script type="text/javascript" src="/framework/angular-toastr/angular-toastr.tpls.min.js"></script>
    <script type="text/javascript" src="/system/service/common.js"></script>
	<script type="text/javascript" src="/system/service/personnelpathservice.js"></script>    
    <script type="text/javascript">
        var mainApp = angular.module("testLogin", ['Common', 'personnelmanagementS']).config(['toastrConfig', '$locationProvider', function (toastrConfig, $locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }); } ]).controller('testLoginCtl', ['$scope', '$location', 'RequestUserService', 'RequestPopService', 'sysUserInfo', 'Msg','Restangular', function ($scope, $location, RM, RPS, sysUserInfo, Msg,Restangular) {

            var param = decodeURI($location.hash(), "UTF-8");
            if (param.indexOf("/") != -1) {
                $scope.user_ID = param.split("/")[0];
                $scope.token = param.split("/")[1];
                sysUserInfo.setuserinfotoken($scope.token);
				Restangular.addFullRequestInterceptor(function (element, operation, route, url, headers, params, httpConfig) {
                    return {
                        headers: { "X-Session-Token": $scope.token, "Content-Type": "application/x-www-form-urlencoded;charset=utf-8" }
                    };
                });
            } else {
                $scope.user_ID = param;
            }

            //登录            
            $scope.user_login = function () {
                localStorage.setItem("flag", "");
                RPS.personnelGetKey({ user_ID: $scope.user_ID }).then(function (retobj) {
                    if (retobj.errorcode == 0) {
                        retobj.data.userId = retobj.data.user_ID;
                        retobj.data.username = retobj.data.user_Name;
                        if (retobj.data.user_Img == "" || retobj.data.user_Img == null || retobj.data.user_Img == undefined) {
                            retobj.data.user_Img = "/images/avatar.png";
                        }
                        localStorage.setItem("userinfo", JSON.stringify(retobj.data));

                        var url=localStorage.getItem("quesUrl");
                        window.location.href = url;

                    } else if (retobj.errorcode == "43") {
                        Msg.warning("企业套餐已过期！");
                    } else if (retobj.errorcode == "44") {
                        Msg.warning("此账号已离职/结业，无法登录！");
                    }
                });
            }
            $scope.user_login();
        } ]);
    </script>    
    <script type="text/javascript" src="/system/service/userpathservice.js"></script>
</body>
</html>
